<script setup>
  import Products from "./products.vue"
  import Network from "./network.vue"
  import Resources from "./resources.vue"
  import UseCases from "./use_cases.vue"
  import { ref } from "vue"

  const clickDom = ref(false);

  const meunClick = (value) => {
    clickDom.value = value;
  }

  const aboutRef = ref(null)
  const productsRef = ref(null)
  const networkRef = ref(null)
  const resourcesRef = ref(null)
  const useCasesRef = ref(null)

  const scrollToAnchor = (refS) => {
    if (refS) {
      refS.scrollIntoView({ behavior: 'smooth' })
    }
  }
</script>

<template>
  <div class="mobile_box">
    <div ref="aboutRef" class="banner">
      <div v-if="!clickDom" class="title wow animate__animated animate__fadeInUp">
        <img src="@/assets/images/w_logo.jpg" alt="">
        <img @click="meunClick(true)" src="@/assets/images/mo/meun.jpg" alt="">
      </div>
      <div v-else class="click_meun_box">
        <div class="click_title">
          <img src="@/assets/images/w_logo.jpg" alt="">
          <img @click="meunClick(false)" src="@/assets/images/mo/close.jpg" alt="">
        </div>
        <div @click="scrollToAnchor(aboutRef)">About</div>
        <div @click="scrollToAnchor(productsRef)">Products</div>
        <div @click="scrollToAnchor(networkRef)">Network</div>
        <div @click="scrollToAnchor(resourcesRef)">Resources</div>
        <div @click="scrollToAnchor(useCasesRef)">Use Cases</div>
      </div>
      <div class="name wow animate__animated animate__fadeInUp">ZKCross</div>
      <div class="text wow animate__animated animate__fadeInUp">
        Revolutionizing <span class="web3">Web3</span> With <span>ZkWASM</span>Fast, Flexible, And On-Chain Verifiable DApps
      </div>
      <div class="des wow animate__animated animate__fadeInUp">
        ZKCross provides an easy to use framework for developers to make their dApp built-in with zk technology. With ZKCross solution, dApp can be proved through zkp, verified on-chain via zkp and proof will be available in DA solutions. 
      </div>
    </div>
    <div ref="productsRef">
      <Products />
    </div>
    <div ref="networkRef">
      <Network />
    </div>
    <div ref="resourcesRef">
      <Resources />
    </div>
    <div ref="useCasesRef">
      <UseCases />
    </div>
  </div>
</template>

<style scoped lang="scss">
.mobile_box {
  width: 100%;
  padding: 2.67%;
  background-color: #Fff;
  box-sizing: border-box;
  .click_meun_box {
    background: rgba(118,118,118, 0.54);
    backdrop-filter: blur(5px); /* 设置背景模糊程度 */
    border-radius: 22px;
    padding: 5.08% 3% 5.08% 5.08%;
    font-weight: 400;
    font-size: 25px;
    color: #FFFFFF;
    line-height: 30px;
    box-sizing: border-box;
    position: absolute;
    top: 3.8%;
    width: 84%;
    margin-left: 8%;
    div {
      margin-top: 20px;
      &:nth-child(2) {
        margin-top: 25px;
      }
    }
    .click_title {
      margin-top: 0px;
      display: flex;
      justify-content: space-between;
      img {
        width: 23px;
      }
    }
  }
  .banner {
    width: 100%;
    border-radius: 33px;
    height: calc(100vh - 20px);
    padding-top: 13.33%;
    box-sizing: border-box;
    background-image: url('@/assets/images/banner.gif');
    background-color: rgba(0,0,0, 0.69);
    background-repeat: no-repeat;
    background-size: cover; /* 背景图片覆盖元素 */
    background-position: center center; /* 背景图片居中 */
    background-blend-mode: multiply;
    position: relative;
    overflow: hidden;
    .name {
      font-weight: bold;
      font-size: 32px;
      color: #FFFFFF;
      text-align: center;
      margin-top: 25.87%;
    }
    .text {
      font-weight: 400;
      font-size: 26px;
      color: #FFFFFF;
      line-height: 34px;
      text-align: center;
      padding: 0px 9.6%;
      margin-top: 18px;
      .web3 {
        font-style: italic;
      }
    }
    .des {
      font-weight: 300;
      font-size: 14px;
      color: #FFFFFF;
      line-height: 18px;
      margin-top: 26px;
      text-align: center;
      padding: 0px 14.93%;
    }
    .title {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0px 10.79%;
      position: absolute;
      width: 100%;
      box-sizing: border-box;
      img {
        width: 23px;
      }
      i {
        color: gray;
        font-size: 20px;
      }
    }
  }
}
</style>
